package StudentManagement5;

public class Student {
    private String name;
    private int age;

    // 构造方法
    public Student(String name) {
        this.name = name;
    }

    // getter/setter方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age >= 22 && age <= 65) {
            this.age = age;
        } else {
            System.out.println("年龄不合适（22-65岁）");
        }
    }
}
